package cc.mrbird.plan.domain;

import cc.mrbird.common.annotation.ExportConfig;
import com.fasterxml.jackson.annotation.JsonFormat;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;

@Table(name="plan_inspection")
public class Inspection implements Serializable {
    /**
     * 巡检计划主要数据内容包括自查单位ID、单位名称、计划类型（此类日常巡检）、
     * 计划起始时间（年月日时间）、结束时间（可确定到年月日时间）、巡查点列表（可批量添加）、
     * 巡查人（对应巡查点）等。
     其他描述：巡检计划有三种状态：待提交、执行中、已完成。当新建计划保存后进入待提交状态。
     */
    private static final long serialVersionUID = 7780821232635882325L;
    @Id
    @GeneratedValue(generator = "JDBC")
    @Column(name = "inspection_id")
    private Integer inspection_id;

    @Column(name = "unit_id")
    @ExportConfig(value = "单位id")
    private Integer unit_id;

    @Column(name = "unit_name")
    @ExportConfig(value = "单位名称")
    private String unit_name;

    @Column(name = "plan_type")
    @ExportConfig(value = "计划类型")
    private String plan_type;

    @Column(name = "plan_start_time")
    @ExportConfig(value = "计划开始时间")
    @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
    private Date plan_start_time;

    @Column(name = "plan_end_time")
    @ExportConfig(value = "计划结束时间")
    @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
    private Date plan_end_time;



    /*@Column(name = "patrol_point")
    @ExportConfig(value = "巡查点列表")*/
    @Transient
    private String patrol_point;

    /*@Column(name = "patrol_people")
    @ExportConfig(value = "巡查人")*/
    @Transient
    private String patrol_people;

    @Column(name = "inspection_status")
    private Integer inspection_status;    //0:待提交、1:执行中、2:已完成
    @ExportConfig(value = "巡检状态")
    private String  inspection_statusStr;

    public Integer getInspection_id() {
        return inspection_id;
    }

    public void setInspection_id(Integer inspection_id) {
        this.inspection_id = inspection_id;
    }

    public Integer getUnit_id() {
        return unit_id;
    }

    public void setUnit_id(Integer unit_id) {
        this.unit_id = unit_id;
    }

    public String getUnit_name() {
        return unit_name;
    }

    public void setUnit_name(String unit_name) {
        this.unit_name = unit_name;
    }

    public String getPlan_type() {
        return plan_type;
    }

    public void setPlan_type(String plan_type) {
        this.plan_type = plan_type;
    }

    public Date getPlan_start_time() {
        return plan_start_time;
    }

    public void setPlan_start_time(Date plan_start_time) {
        this.plan_start_time = plan_start_time;
    }

    public Date getPlan_end_time() {
        return plan_end_time;
    }

    public void setPlan_end_time(Date plan_end_time) {
        this.plan_end_time = plan_end_time;
    }

    public String getPatrol_point() {
        return patrol_point;
    }

    public void setPatrol_point(String patrol_point) {
        this.patrol_point = patrol_point;
    }

    public String getPatrol_people() {
        return patrol_people;
    }

    public void setPatrol_people(String patrol_people) {
        this.patrol_people = patrol_people;
    }

    public Integer getInspection_status() {
        return inspection_status;
    }

    public void setInspection_status(Integer inspection_status) {
        this.inspection_status = inspection_status;
    }

    public String getInspection_statusStr() {
        //0:待提交、1:执行中、2:已完成
        if(inspection_status==0){
            inspection_statusStr="待提交";
        }
        if(inspection_status==1){
            inspection_statusStr="执行中";
        }
        if(inspection_status==2){
            inspection_statusStr="已完成";
        }
        return inspection_statusStr;
    }

    public void setInspection_statusStr(String inspection_statusStr) {
        this.inspection_statusStr = inspection_statusStr;
    }

    @Override
    public String toString() {
        return "Inspection{" +
                "inspection_id=" + inspection_id +
                ", unit_id=" + unit_id +
                ", unit_name='" + unit_name + '\'' +
                ", plan_type='" + plan_type + '\'' +
                ", plan_start_time=" + plan_start_time +
                ", plan_end_time=" + plan_end_time +
                ", patrol_point='" + patrol_point + '\'' +
                ", patrol_people='" + patrol_people + '\'' +
                ", inspection_status=" + inspection_status +
                ", inspection_statusStr='" + inspection_statusStr + '\'' +
                '}';
    }
}
